/**
 * @file configbase.h
 * @author  haifeng (haifengxiao@icloud.com)
 * @brief
 * @version 0.1
 * @date 2021-07-07
 *
 * @copyright Copyright (c) 2021
 *
 */

#pragma once

#include <string>
#include <memory>
#include <sstream>
#include <boost/lexical_cast.hpp>

namespace Chen {
    namespace Conf {

        class ConfigValBase {
        public:
            typedef std::shared_ptr<ConfigValBase> ptr;

            /**
             * @brief Construct a new Config Val Base object
             *
             * @param name
             * @param description
             */
            ConfigValBase(const std::string& name, const std::string& description = "");

            /**
             * @brief Destroy the Config Val Base object
             *
             */
            ~ConfigValBase() {}

            /**
             * @brief Get the Name object
             *
             * @return std::string
             */
            std::string getName() const { return m_name; }

            /**
             * @brief Get the Description object
             *
             * @return std::string
             */
            std::string getDescription() const { return m_description; }

            /**
             * @brief
             *
             * @return std::string
             */
            virtual std::string toString() = 0;

            /**
             * @brief
             *
             * @param val
             * @return std::string
             */
            virtual bool fromString(const std::string& val) = 0;

        protected:
            std::string m_name;
            std::string m_description;
        };

    }//namespace Conf
}//namespace Chen